import Router from '@koa/router'
import userRoutes from './api/users-new'
// import postRoutes from './api/posts'
// import commentRoutes from './api/comments'
// import authRoutes from './api/auth'

export function createRouter(): Router {
    const router = new Router({
        prefix: '/api'
    })

    // 健康检查
    router.get('/health', async (ctx) => {
        ctx.body = {
            success: true,
            message: 'Server is healthy',
            timestamp: new Date().toISOString()
        }
    })

    // API 路由
    // router.use('/auth', authRoutes.routes(), authRoutes.allowedMethods())
    router.use('/users', userRoutes.routes(), userRoutes.allowedMethods())
    // router.use('/posts', postRoutes.routes(), postRoutes.allowedMethods())
    // router.use('/comments', commentRoutes.routes(), commentRoutes.allowedMethods())

    return router
}
